/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxn = 2e5;

int ecnt;
int heads[maxn + 1];

struct Edge {
  int v, nxt;
} e[maxn * 2 + 2];

inline void add(int u, int v) {
  e[++ecnt].v = v, e[ecnt].nxt = heads[u], heads[u] = ecnt;
}

std::vector<int> ans;

// int son[maxn];

void dfs(int u, int center, int fa) {
  int cnt = 0;
  for (int i = heads[u]; i; i = e[i].nxt) {
    int v = e[i].v;
    if (v == fa) continue;
    dfs(v, (center + 1) % 3, u);
    ++cnt;
  }
  if (center == 0) {
    ans.push_back(cnt + 1);
  }
}

// void dfs2(int u, int center, int fa) {
//   for (int i = heads[u]; i; i = e[i].nxt) {
//     int v = e[i].v;
//     if (v == fa) continue;
//     dfs(v, !center, u);
//     son[u]++;
//   }
// }

int deg[maxn + 1];

int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    add(u, v);
    add(v, u);
    deg[u]++, deg[v]++;
  }
  for (int i = 1; i <= n; ++i) {
    if (deg[i] == 1) {
      // dfs2(i, 2, i);
      dfs(i, 2, i);
      break;
    }
  }
  // cout << ans.size() << endl;
  std::sort(ans.begin(), ans.end());
  for (auto i : ans) {
    cout << i << ' ';
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("E - A Gift From the Stars.in", "r", stdin);
  freopen("E - A Gift From the Stars.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
